//注意输入的拼接字符
#include <iostream>
using namespace std;

const int maxsize = 100;

class Stack {
public:
    Stack() : size(0) {}
    ~Stack() = default;
    int push(int n);
    int pop();
    void core();
    void printfruit();
private:
    int list[maxsize];
    int size;
};

int main() {
    Stack s;
    s.core();
    s.printfruit();
    return 0;
}

int Stack::push(int n) {
    this->list[this->size ++] = n;
    return 0;
}

int Stack::pop() {
    this->size --;
    return this->list[this->size];
}

void Stack::core() {
    string s;
    cin >> s;
    int now = 0;
    for (char c : s) {
        if (c == '@') break;
        if (c >= '0' && c <= '9') {
            now = now * 10 + (c - '0');
        }
        else if (c == '.') {
            push(now);
            now = 0;
        }
        else if (c == '+') {
            int later = pop();
            int former = pop();
            push(later + former);
        }
        else if (c == '*') {
            int later = pop();
            int former = pop();
            push(former * later);
        }
        else if (c == '/') {
            int later = pop();
            int former = pop();
            push(former / later);
        }
        else if (c == '-') {
            int later = pop();
            int former = pop();
            push(former - later);
        }
    }
}

void Stack::printfruit() {
    cout << list[0] << endl;
}